<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="/admin/css/style.css" rel="stylesheet" type="text/css"/>
 <script type="text/javascript" src="/admin/js/jquery.js"></script>
<link rel="stylesheet" href="/admin/js/kindeditor/themes/default/default.css" />
 <script charset="utf-8" src="/admin/js//kindeditor/kindeditor-min.js"></script>
 <script charset="utf-8" src="/admin/js/kindeditor/lang/zh_CN.js"></script>
 <script type="text/javascript" src="/admin/js/Validform_v5.3.2_min.js"></script>
<script>
	$(function() {
		//表单验证
		$(".modelform").Validform({
			tiptype:3
		});
	});			
</script>
</head>
</head>
<body>
<div class="colorarea01">
	<div class="search clearfix">
		<div class="searchL">
			<ul class="menulist">
				<li><a href="{{url('brands/cmlist')}}" class="list">返回车型列表</a></li>
			</ul>
		</div>
	</div>
	<form name="form1" class="modelform" method="post"  enctype="multipart/form-data"  action="">
	{!!csrf_field()!!}
		<table cellspacing="0" cellpadding="0" width="100%"  class="maintable">
			<tr>
              <th>一级品牌：</th>
              <td> 
					<select name="p_brand" id="brand" datatype="n" nullmsg="请选择品牌！">
						<option value="">请选择品牌</option>
						@foreach ($cars as $u)
						<option value="{{$u->b_id}}" onclick="xi()">
						<span>{{$u->mark}}</span>
						{{$u->b_name}}</option>
						@endforeach	
					</select>
              </td>
            </tr>

            <script>
				function xi(){
                var b_id = $('select[name=p_brand] option:selected').val();
                $.ajax({
                url:"{{'/admin/getAttributeByType'}}",
                data:{'b_id':b_id},
                dataType:'json',
                type:'get',
                success:function(msg){
                     var s = "";
                        s += "<select name ='p_subbrand' id='subbrand'>";
                        s += "<option value='0'>--请选择--</option>";
                        $.each(msg,function(kk,vv){
                           s+="<option value='"+vv.b_id+"' onclick='son()'>"+vv.b_name+"</option>";
                        });
                        s += "</select>";
                    $('#subbrand').remove();
                    $('em').append(s);
                }
                
                });
            }
					</script>
				
				<script>
					function son(){
					var b_id = $('select[name=p_subbrand] option:selected').val();
						$.ajax({
						url:"{{'/admin/songetAttributeByType'}}",
						data:{'b_id':b_id},
						dataType:'json',
						type:'get',
					success:function(msg){
					var s = "";
						s += "<select name ='p_subsubbrand' id='subsubbrand'>";
						s += "<option value='0'>--请选择--</option>";
						$.each(msg,function(kk,vv){
						s+="<option value='"+vv.b_id+"' >"+vv.b_name+"</option>";
						});
						s += "</select>";
						$('#subsubsubbrand').remove();
						$('#span').append(s);
						}
						});
						}
				</script>



            <tr>
              <th>二级品牌：</th>
			  <td><em>
			  	
			  </em>
                  <select class="subbrand" id="subbrand" name="p_subbrand" datatype="n" nullmsg="请选择车系！">
				  <option  value="">请选择车系</option>
                  <{$select_subbrand}>
			  </td>
            </tr>
            <tr>               
			  <th>添加新款式：</th>
			  <td>
                  <input type="radio" name="isaddmodel"   value="1" >
                  <input name="b_name4"  type="text" id="b_name4" size="11" value=""/>
              </td>
            </tr>
            <tr> 
                <th>现有款式：</th>
                <td>
                    <input type="radio" name="isaddmodel"  checked="checked"  value="0" >

                    <span id="span"></span>
                    <select class="subbrand" id="subsubsubbrand" name="p_subsubbrand">
					<option  value="">请选择款式</option>
					<{$select_fourbrand}>
					</select>
                </td>
			</tr>
			<tr>
				<th>具体车型：</th>
				<td><input name="b_name5" type="text" id="b_name5" size="30" value="" />
                </td>
			</tr>
			<tr>
				<th></th>
				<td><div class="buttons">
						<input type="submit" name="thevaluesubmit" value="提交保存" class="submit">
						<input type="hidden" name="a" value="<{$ac}>">
                        <input type="hidden" name="b_id" value="">
						<input name="valuesubmit" type="hidden" value="yes" />
					</div></td>
			</tr>
		</table>
	</form>
</div>
</body>
</html>